Skip to content

fix: recover android network dump after stale logcat pid#363

Merged
thymikee merged 1 commit intomainfrom
codex/android-network-dump-stale-pid
Apr 7, 2026
Merged

fix: recover android network dump after stale logcat pid#363
thymikee merged 1 commit intomainfrom
codex/android-network-dump-stale-pid

Conversation

@thymikee
Copy link
Copy Markdown
Contributor

@thymikee thymikee commented Apr 7, 2026

Summary

Recover Android network dump when the session logcat stream stays active but is still bound to a previous app PID after a process restart.
Detect the tracked --pid from the session app-log metadata, compare it with the app's current PID, and reuse the existing bounded adb logcat -d recovery path when they diverge. Add focused coverage for the stale-active PID case.

Closes #333

Validation

  • pnpm format
  • pnpm check:quick
  • pnpm check:unit
  • node --experimental-strip-types src/bin.ts open com.expensify.chat.dev --platform android --serial emulator-5552 --session issue333-followup --state-dir /tmp/agent-device-issue333-followup
  • node --experimental-strip-types src/bin.ts logs clear --restart --session issue333-followup --state-dir /tmp/agent-device-issue333-followup
  • Forced com.expensify.chat.dev process restart on the Android emulator and verified network dump 10 returned fresh recovered HTTP entries with the stale-PID recovery note

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-363/

Built to branch gh-pages at 2026-04-07 16:44 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@thymikee thymikee merged commit 3eccb5b into main Apr 7, 2026
16 checks passed
@thymikee thymikee deleted the codex/android-network-dump-stale-pid branch April 7, 2026 16:48
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a14617e510

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (!trackedPid) {
return null;
}
const currentPid = await resolveAndroidPid(device.id, appBundleId);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add timeout to stale-PID probe before network dump

In readSessionNetworkCapture, active Android sessions now run resolveAndroidPid unconditionally to detect stale logcat PID bindings, but that helper runs adb shell pidof without a timeout. If adb transport is wedged (for example, flaky USB/emulator bridge), network dump can hang even though parsing the existing session app.log would have succeeded. This is a regression specific to the new stale-active path; make the PID probe best-effort with a short timeout and skip recovery when it fails.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Android submit-window network timing capture

1 participant